<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function ListNode(val) {
            this.val = val;
            this.next = null;
        }
        let obj = {}
        let isAdd = 0;
        let isFrist = false;
        var addTwoNumbers = function(l1, l2) {
            function Rec(l1, l2) {
                if(l1.next && l2.next) {
                    var next = Rec(l1.next, l2.next);
                }
                let node = new ListNode(l1.val + l2.val + isAdd);
                if(node.val >= 10) {
                    isAdd = 1;
                    node.val -= 10;
                }else {
                    isAdd = 0;
                }
                if(!isFrist) {
                    isFrist = true;
                    console.log(node)
                    return node
                }
                console.log(next)
                next.next = node;
                return next
            }
            let a = Rec(l1, l2)
            console.log(a)
        };    
    </script>
</body>
</html>